<?php
/**
 * 商户 - 入驻申请管理
 */

namespace App\store\controllers\common;

use App\store\controllers\StoreBaseController;
use App\store\models\SettleApplyModel;
use App\store\services\CommonServices;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;


class SettleApplyController extends StoreBaseController
{

    private $class_name = 'Common';

    /**
     * 入驻申请
     */
    public function settleApply(Request $request)
    {
        //获取数据
        $data = self::getStoreData($this->class_name, 'settleApply', 2);
        if ($data) {
            return $data;
        }
        $data = $request->all();
        $validator = Validator::make(
            $data,
            SettleApplyModel::rules(),
            SettleApplyModel::message()
        );
        if ($validator->fails()) {
            $msg = $validator->errors()->all();
            return $this->errorJson($msg[0], []);
        }
        $list = CommonServices::settleApply($data);
        return successJson('ok', $list);
    }

}

